package edu.hubu.work01.controller;

import edu.hubu.work01.entity.Feed;
import edu.hubu.work01.Service.FeedService;
import edu.hubu.work01.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
public class FeedController {
    @Autowired

    private FeedService feedService;

    @RequestMapping("/feed/buy")
    public ResultVO buy(int feedId,int weight){
        return feedService.buyFeed(feedId,weight);
    }
    @RequestMapping("/feed/add")
    public ResultVO add(Feed feed){
        return feedService.addFeed(feed);

    }
    @RequestMapping("/feed/list")
    public ResultVO list(){
        return feedService.listFeed();
    }
}
